package com.mqb.config.mixin;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.mqb.model.Role;
import com.mqb.model.User;
import org.springframework.security.jackson2.SecurityJackson2Modules;

/**
 * @author mqb
 * @date 2021/4/7 10:42
 */
public class CustomModule extends SimpleModule {
    public CustomModule() {
        super(CustomModule.class.getName(), new Version(1, 0, 0, null, null, null));
    }

    @Override
    public void setupModule(SetupContext context) {
        SecurityJackson2Modules.enableDefaultTyping(context.getOwner());
        context.setMixInAnnotations(User.class, UserMixin.class);
        context.setMixInAnnotations(Role.class, RoleMixin.class);
    }
}
